
package com.ikamobile.flickrer;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;

public class ImageViewerActivity extends Activity {
    static final String EXTRA_IMAGE_URL = "IMAGE_URL";
    private ImageView mImageView;
    private ProgressBar mProgress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.image_viewer);
        mImageView = (ImageView) findViewById(R.id.photo);
        mProgress = (ProgressBar) findViewById(R.id.progress);
        populate();
    }

    private void populate() {
        mProgress.setVisibility(View.VISIBLE);
        String photoUrl = getImageUrl();
        new PhotoHelper(this).loadOrSetImage(mImageView, photoUrl, mProgress);
    }

    private String getImageUrl() {
        return getIntent().getStringExtra(EXTRA_IMAGE_URL);
    }

}
